class Solution(object):
    def rotate(self, matrix):
        """
        :type matrix: List[List[int]]
        :rtype: None Do not return anything, modify matrix in-place instead.
        """
        m = {}
        matrix_len = len(matrix)
        for i in range(matrix_len):
            for j in range(matrix_len):
                ii = j
                jj = matrix_len - i - 1
                m[(ii, jj)] = matrix[ii][jj]
                if (i, j) in m:
                    matrix[ii][jj] = m[(i, j)]
                else:
                    matrix[ii][jj] = matrix[i][j]
